package com.uchedao.seller.ui.car.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.LinearLayout;

import com.uchedao.seller.R;
import com.uchedao.seller.http.entity.BidPriceEntity;
import com.uchedao.seller.ui.adapter.CommonAdapter;
import com.uchedao.seller.ui.adapter.ViewHolder;
import com.uchedao.seller.util.Arith;

import java.util.List;

/**
 * Created by hang on 2015/10/29.
 */
public class BidPriceAdapter extends CommonAdapter<BidPriceEntity> {

    public BidPriceAdapter(Context context, List<BidPriceEntity> data) {
        super(context, data, R.layout.item_bid_price);
    }

    @SuppressLint("StringFormatMatches")
    @Override
    public void conver(ViewHolder holder, BidPriceEntity item, int position) {
        holder.setText(R.id.tvBidItemPrice, mContext.getString(R.string.bid_price, Arith.div(item.getPrice(),10000)+""));
        holder.setText(R.id.tvBidItemCity, item.getProvince_caption()+item.getCity_caption());
        holder.setText(R.id.tvBidItemNum, mContext.getString(R.string.bid_num, item.getMax_demand()+"", item.getAll_bid_num()+""));

        LinearLayout llBg = holder.getView(R.id.llBidItemBg);
        if (item.getIs_max_price() == 0) {
             llBg.setBackgroundColor(mContext.getResources().getColor(R.color.green_light));
        } else {
            llBg.setBackgroundColor(mContext.getResources().getColor(R.color.orange_dark));
        }
    }
}
